package com.bbx.taxi.client.Activity.Order;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import net.simonvt.menudrawer.MenuDrawer;
import net.simonvt.menudrawer.Position;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import butterknife.ButterKnife;
import butterknife.InjectView;

import com.bbx.androidapi.util.ToastUtil;
import com.bbx.api.gclient.GMsg;
import com.bbx.api.gclient.Observer;
import com.bbx.api.gclient.msg.CouponMsg;
import com.bbx.api.sdk.SDK;
import com.bbx.api.sdk.model.comm.returns.line.To_Cities;
import com.bbx.api.sdk.model.official.passanger.Return.OrderList.OfficialOrderDetail;
import com.bbx.api.sdk.model.official.passanger.Return.OrderList.OfficialOrderList;
import com.bbx.api.sdk.model.passanger.MyOrder;
import com.bbx.api.sdk.model.passanger.PriceBuild;
import com.bbx.api.sdk.model.passanger.Return.ChangeOrderId;
import com.bbx.api.sdk.model.passanger.Return.Elements;
import com.bbx.api.sdk.model.passanger.Return.OrderDetails;
import com.bbx.api.sdk.model.passanger.Return.OrderId;
import com.bbx.api.sdk.model.passanger.Return.Price;
import com.bbx.api.sdk.model.passanger.Return.Coupon.CouponList;
import com.bbx.api.sdk.model.passanger.Return.Coupon.Coupons;
import com.bbx.api.sdk.model.passanger.Return.Coupon.Metadata;
import com.bbx.api.sdk.model.passanger.Return.Jmsg.Msgs;
import com.bbx.api.sdk.model.passanger.Return.MyOrderList.End;
import com.bbx.api.sdk.model.passanger.Return.MyOrderList.Location;
import com.bbx.api.sdk.model.passanger.Return.MyOrderList.Start;
import com.bbx.api.sdk.net.base.JsonBuild;
import com.bbx.api.sdk.net.passeger.conn.ChangeOrderSubmitNet;
import com.bbx.api.sdk.net.passeger.conn.CouponUsableNet;
import com.bbx.api.sdk.net.passeger.conn.MyOrderNet_Unfini;
import com.bbx.api.sdk.net.passeger.conn.OrderDetailNet;
import com.bbx.api.sdk.net.passeger.conn.PriceNet;
import com.bbx.taxi.client.Task.BaseAsyncTask;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.official.R;
import com.bbx.taxi.client.Activity.MainActivity;
import com.bbx.taxi.client.Activity.Address.AddressActivity;
import com.bbx.taxi.client.Activity.Menu.CouponActivity;
import com.bbx.taxi.client.Activity.Menu.MyOrderActivity;
import com.bbx.taxi.client.Activity.Menu.PersonalDataActivity;
import com.bbx.taxi.client.Activity.Menu.SetActivity;
import com.bbx.taxi.client.Activity.Order.StartServiceActivity;
import com.bbx.taxi.client.Activity.login.LoginActivity;
import com.bbx.taxi.client.Adapter.Page.MyPagerFragmentAdapter;
import com.bbx.taxi.client.Bean.Value;
import com.bbx.taxi.client.Bean.Attribute.ChangeAttribute;
import com.bbx.taxi.client.Bean.Attribute.ChangeAttribute.OnContentFillingListener;
import com.bbx.taxi.client.Bean.Extra.MainMsg;
import com.bbx.taxi.client.Bean.Extra.OrderMsg;
import com.bbx.taxi.client.Bean.Message.ObserverListener;
import com.bbx.taxi.client.Bean.Message.Publisher;
import com.bbx.taxi.client.DB.AddressDB;
import com.bbx.taxi.client.DB.JmsgDB;
import com.bbx.taxi.client.DB.LineDB;
import com.bbx.taxi.client.DB.MyOrder.MyOrderDB;
import com.bbx.taxi.client.DB.MyOrder.MyOrderLocationsDB;
import com.bbx.taxi.client.DB.MyOrder.MyOrderingDB;
import com.bbx.taxi.client.Service.LoginService;
import com.bbx.taxi.client.Task.MyOrderTask;
import com.bbx.taxi.client.Util.AppStarted;
import com.bbx.taxi.client.Util.DataCleanManager;
import com.bbx.taxi.client.Util.DateFormat;
import com.bbx.taxi.client.Util.FormatUtil;
import com.bbx.taxi.client.Util.NetworkDetector;
import com.bbx.taxi.client.Util.ToCity;
import com.bbx.taxi.client.widget.Dailog.MyAlertDailog;
import com.bbx.taxi.client.widget.Dailog.MyBusyDailog;
import com.bbx.taxi.client.widget.Dailog.MyPayOrderDailog;
import com.bbx.taxi.client.widget.Dailog.MyTypeDailog;
import com.bbx.taxi.client.widget.Dailog.MyAlertDailog.onClickLeftListener;
import com.bbx.taxi.client.widget.Dailog.MyAlertDailog.onClickRightListener;
import com.bbx.taxi.client.widget.Dailog.MyPayOrderDailog.onClickPayListener;
import com.bbx.taxi.client.widget.StatusBar.StatusBar;
import com.bbx.taxi.client.widget.pop.CollecteAddressPop.OnAddressPoPViewStateListener;
import com.bbx.taxi.client.widget.pop.CollecteAddressPop;
import com.bbx.taxi.client.widget.pop.DatePicker;
import com.bbx.taxi.client.widget.pop.DatePicker.OnPoPViewStateListener;
import com.example.loadview.LoadingDialog;
import com.umeng.analytics.MobclickAgent;

/**
 * 修改订单
 * 
 */
public class ChangeOrderActivity extends FragmentActivity {
//implements
//		OnClickListener, OnPageChangeListener, OnContentFillingListener,OnAddressPoPViewStateListener,
//		 OnPoPViewStateListener, ObserverListener
//		 {
//	@InjectView(R.id.layout_carpooling)
//	RelativeLayout layout_carpooling;
//	@InjectView(R.id.layout_charteredcar)
//	RelativeLayout layout_charteredcar;
//	@InjectView(R.id.btn_carpooling)
//	ImageView btn_carpooling;
//	@InjectView(R.id.btn_charteredcar)
//	ImageView btn_charteredcar;
//	@InjectView(R.id.tv_carpooling)
//	TextView tv_carpooling;
//	@InjectView(R.id.tv_charteredcar)
//	TextView tv_charteredcar;
//	/** 个人信息 */
//	@InjectView(R.id.personalDate)
//	RelativeLayout personalDate;
//	/** 注册电话 */
//	@InjectView(R.id.tv_phone)
//	TextView tv_phone;
//	@InjectView(R.id.tv_name)
//	TextView tv_name;
//	@InjectView(R.id.tv_address)
//	TextView tv_address;
//	@InjectView(R.id.tv_coupon)
//	TextView tv_coupon;
//	@InjectView(R.id.tv_set)
//	TextView tv_set;
//	@InjectView(R.id.tv_myorder)
//	TextView tv_myorder;
//	@InjectView(R.id.confirm)
//	Button confirm;
//	@InjectView(R.id.pop_background)
//	View pop_background;
//	@InjectView(R.id.tv_title)
//	TextView tv_title;
//	@InjectView(R.id.iv_left)
//	ImageView iv_left;
//
//	/**
//	 * 当前的View的id
//	 */
//	private int viewId = 1;
//	private String old_order_id;
//	ViewPager viewpager = null;
//	ArrayList<Fragment> fragments = null;
//	PagerAdapter adapter = null;
//	public static Activity context;
//	protected MenuDrawer mMenuDrawer;
//	private TextView currentTextView;
//	private long mkeyTime;
//	private String sn = "push_offline";// 序列号
//	/** 可用优惠劵 */
//	private List<Coupons> list_available = new ArrayList<Coupons>();
//	/** 是否点开可用优惠劵 */
//	private boolean isOpenAvailable = false;
//	/** 修改界面的信息临时存储 */
//	private ChangeAttribute change_attribute;
//	private MyOrderingDB db_myordering;// 我的进行中的订单数据库
//	private MyOrderDB db_myorder;// 我的订单数据库
//	private MyOrderLocationsDB db_locations;// 我的订单的Locations数据库
//	private AddressDB db_address;// 我的地址
//	private LineDB db_line;// 线路数据库
//	private ChangeCarpoolingFragment mChangeCarpoolingFragment;
//	private ChangeCharteredCarFragment mChangeCharteredCarFragment;
//	private ChangeOrderSubmitTask mChangeOrderSubmitTask;
//	/** 生成可用优惠劵 */
//	private CouponUsableTask mCouponUsableTask;
//	/**价格*/
//	private PriceTask mPriceTask;
//	String line_id = "";
//	int coupon_id=0;
//	private LoadingDialog dialog;
//	List<Elements> elements;
//	private MyApplication mApplication;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//		context = this;
//		mApplication=MyApplication.getInstance();
//		mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND,
//				Position.START, MenuDrawer.MENU_DRAG_CONTENT);
//		mMenuDrawer.setMenuView(R.layout.leftmenu);// 设置菜单视图
//		mMenuDrawer.setContentView(R.layout.activitu_change);
//		mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_NONE);
//		ButterKnife.inject(this);
//		Publisher.getInstance().addOb(this);
//		change_attribute = ChangeAttribute.getInstance();
//		StatusBar.setTranslucentStatus(this,true);
//		initData();
//		init();
//		initView();
//
	}
}
//
//	@Override
//	protected void onResume() {
//		MobclickAgent.onResume(this);
//		Publisher.getInstance().addOb(this);
//		super.onResume();
//		if (!Value.isActive&&Value.isUnSDK) {  
//	        //app 从后台唤醒，进入前台        
//			Value.isActive = true;  
//			if (mApplication.getUid() != null && !mApplication.equals("")
//					&& mApplication.getToken() != null
//					&& !mApplication.getToken().equals("")) {
//			} else {
//				ToastUtil.showToast(context, R.string.account_exception);
//				Intent intent = new Intent(this, LoginActivity.class);
//				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//				startActivity(intent);
//			}
//		  }
//		if(!Value.isActive){
//			if (mApplication!=null) {
//				MyOrderingTask.getInstance(context);
//				MyOrderTask.getInstance(context);
//			}
//		}
//	}
//	@Override
//	protected void onStop() {
//		super.onStop();
//		if (!AppStarted.isRunningForeground(this)) {
//			// 记录当前已经进入后台app 进入后台
//			Value.isActive = false;
//		}
//	}
//	public void onPause() {
//		super.onPause();
//		MobclickAgent.onPause(this);
//	}
//	private void initData() {
//		Intent intent = getIntent();
//		switch(intent.getIntExtra(OrderMsg.change_order_type,Value.ORDER_TYPE_PC)){
//		case Value.ORDER_TYPE_PC:
//			viewId =0 ;
//			break;
//		case Value.ORDER_TYPE_BC:
//			viewId = 1;
//			break;
//		}
//		old_order_id=intent.getStringExtra(OrderMsg.change_old_order_id);
//	}
//
//	private void init() {
//		tv_title.setText(context.getString(R.string.change_title));
//		viewpager = (ViewPager) findViewById(R.id.viewpager);
//		fragments = new ArrayList<Fragment>();
//		mChangeCarpoolingFragment = new ChangeCarpoolingFragment(old_order_id);
//		mChangeCharteredCarFragment = new ChangeCharteredCarFragment(old_order_id);
//		fragments.add(mChangeCarpoolingFragment);// 拼车出行
//		fragments.add(mChangeCharteredCarFragment);// 包车出行
//		adapter = new MyPagerFragmentAdapter(getSupportFragmentManager(),
//				fragments);
//		viewpager.setAdapter(adapter);
//		viewpager.setOnPageChangeListener(this);
//		iv_left.setOnClickListener(this);
//		//
//		layout_carpooling.setOnClickListener(this);
//		layout_charteredcar.setOnClickListener(this);
//		personalDate.setOnClickListener(this);
//		tv_address.setOnClickListener(this);
//		tv_coupon.setOnClickListener(this);
//		tv_set.setOnClickListener(this);
//		confirm.setOnClickListener(this);
//		tv_myorder.setOnClickListener(this);
//		pop_background.setOnClickListener(this);
//		change_attribute.setOnContentFillingListener(this);
//		DatePicker.setOnPoPViewStateListener(this);
//		CollecteAddressPop.setOnAddressPoPViewStateListener(this);
//		setButton(btn_carpooling, tv_carpooling);
//		mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
//		viewpager.setCurrentItem(viewId);
//	}
//
//	private void initView() {
//		dialog = new LoadingDialog(context);
//		db_myordering = new MyOrderingDB(this);
//		db_myorder = new MyOrderDB(this);
//		db_locations = new MyOrderLocationsDB(this);
//		db_address=new AddressDB(this);
//		db_line=new LineDB(this);
//		tv_phone.setText(FormatUtil
//				.onFormatTelephone(mApplication.user_phone));
//		tv_name.setText(mApplication.user_name.equals("") ? "乘客"
//				: mApplication.user_name);
//	}
//
//	public void onClick(View v) {
//		switch (v.getId()) {
//		case R.id.iv_left:
//			finish();
//			overridePendingTransition(0, R.anim.base_slide_right_out);
//			break;
//		case R.id.layout_carpooling:// 拼车出行
//			viewpager.setCurrentItem(0);
//			break;
//		case R.id.layout_charteredcar:// 包车出行
//			viewpager.setCurrentItem(1);
//			break;
//		case R.id.personalDate:
//			startActivity(new Intent(ChangeOrderActivity.this,
//					PersonalDataActivity.class));
//			break;
//		case R.id.tv_address:
//			startActivity(new Intent(ChangeOrderActivity.this,
//					AddressActivity.class));
//			break;
//		case R.id.tv_set:
//			startActivity(new Intent(ChangeOrderActivity.this,
//					SetActivity.class));
//			break;
//		case R.id.confirm:
//			getPrice(v);
//			break;
//		case R.id.tv_myorder:
//			startActivity(new Intent(ChangeOrderActivity.this,
//					MyOrderActivity.class));
//			break;
//		case R.id.tv_coupon:
//			startActivity(new Intent(ChangeOrderActivity.this,
//					CouponActivity.class));
//			break;
//		default:
//			break;
//		}
//	}
//
//	private void setButton(ImageView v, TextView tv) {
//		switch (viewId) {
//		case 0:
//			v.setImageResource(R.drawable.btn_pc);
//			btn_charteredcar.setImageResource(R.drawable.icon_down_nor);
//			break;
//		case 1:
//			v.setImageResource(R.drawable.btn_bc);
//			btn_carpooling.setImageResource(R.drawable.icon_down_nor);
//			break;
//		}
//		setTextViewColor(tv);
//		if (!mOnMenuClickListenerList.isEmpty()) {
//			for (int i = 0; i < mOnMenuClickListenerList.size(); i++) {
//				mOnMenuClickListenerList.get(i).OnMenuClick();
//			}
//		}
//	}
//
//	/**
//	 * 设置，小件快递，拼车出行，包车出行的字体颜色
//	 */
//	private void setTextViewColor(TextView v) {
//		if (currentTextView != null && currentTextView.getId() != v.getId()) {
//			currentTextView.setTextColor(getResources().getColor(
//					R.color.text_nor));
//		}
//		v.setTextColor(getResources().getColor(R.color.btn_pre));
//
//		currentTextView = v;
//	}
//	/**
//	 * 判断是否有改动
//	 */
//	public String isChange(){
//		String tixing="";
//		OfficialOrderList mOfficialOrderList=db_myorder.onReadDB(context, old_order_id);
//		OfficialOrderDetail mOfficialOrderDetail = mOfficialOrderList.getOrderDetail();
//		String no_change=this.getResources().getString(R.string.order_no_change);
//		tixing=no_change;
//		//判断时间
//		if(change_attribute.getTime().equals(Value.now_time)){
//			tixing="";
//		}
//		if(Math.abs(DateFormat.onDate_Long(mOfficialOrderList.getAppoint_time())-DateFormat.onDate_Long(change_attribute.getTime()))>1000*60){
//			tixing="";
//		}
//		//判断地址
//		if(!mOfficialOrderDetail.getStart().getAddress().equals(change_attribute.getStartName())){
//			tixing="";
//		}
//		if(!mOfficialOrderDetail.getEnd().getAddress().equals(change_attribute.getEndName())){
//			tixing="";
//		}
//		//判断名字
//		if(!mOfficialOrderDetail.getStart().getName().equals(change_attribute.getName())){
//			tixing="";
//		}
//		//判断电话
//		if(!mOfficialOrderDetail.getStart().getPhone().equals(change_attribute.getTel())){
//			tixing="";
//		}
//		//判断人数
//		if(mOfficialOrderDetail.getCount()!=change_attribute.getCount())
//		{
//			tixing="";
//		}
//		//判断拼车留言
//		switch(viewId){
//		case 0:
//			if(!mOfficialOrderList.getMessage().equals(change_attribute.getMessage_PC())){
//				tixing="";
//			}
//			break;
//		case 1:
//			if(!mOfficialOrderList.getMessage().equals(change_attribute.getMessage_BC())){
//				tixing="";
//			}
//		break;
//		}
//		if(mOfficialOrderList.getOrder_type()!=viewId){
//			tixing="";
//		}
//		if(mOfficialOrderList.getOrder_status()>=Value.ORDER_STATUS_ONCAR){
//			tixing=this.getResources().getString(R.string.order_status_no_change);
//		}
//		return tixing;
//	}
//	
//	 /**
//     * 获取价格
//     */
//    public void getPrice(View v){
//    	if(!isChange().equals("")){
//    		ToastUtil.showToast(context, isChange());
//    		return;
//    	}
//    	if(!NetworkDetector.detect(this)){
//			ToastUtil.showToast(context, getResources().getString(R.string.no_network));
//			return;
//		}
//		boolean isContinue = false;// 根据城市，是否有这条路线，有则继续
//		ArrayList<To_Cities> to_citylist =ToCity.getToCity(context, change_attribute.getStartCity(),false);
//		line_id=ToCity.getLine(to_citylist, change_attribute.getEndCity());
//		if(line_id!=null){
//			isContinue = true;
//		}
//		if (!isContinue) {
//			Toast.makeText(this, "暂不支持这两地的路线", Toast.LENGTH_SHORT).show();
//			return;
//		}	
//		setElements();
//		PriceBuild mPriceBuild=new PriceBuild(context);
//		mPriceBuild.uid=mApplication.getUid();
//		mPriceBuild.access_token=mApplication.getToken();
//		mPriceBuild.line_id=line_id;
//		mPriceBuild.elements=elements;
//		switch(viewId){
//		case 0:
//			mPriceBuild.order_type=Value.ORDER_TYPE_PC;
//			break;
//		case 1:
//			mPriceBuild.order_type=Value.ORDER_TYPE_BC;
//			break;
//		}
//		
//		if (dialog != null && !dialog.isShowing()) {
//			dialog.show();
//		}
//		mPriceTask=new PriceTask(this, mPriceBuild, v);
//		mPriceTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
//		
//		
//    }
//	/**
//	 * 生成可用优惠劵
//	 */
//    public void getCouponUsable(int price, View v) {
//		CouponUsable mCouponUsable = new CouponUsable(context);
//		mCouponUsable.uid = mApplication.getUid();
//		mCouponUsable.access_token = mApplication.getToken();
//		Date date = new Date();
//		mCouponUsable.ordertime = DateFormat.onDate_Long(change_attribute.getTime())/1000;
//		mCouponUsable.ordersum = 0;
//		switch (viewId) {
//		case 0:
//			mCouponUsable.ordertype =Value.ORDER_TYPE_PC;
//			break;
//		case 1:
//			mCouponUsable.ordertype =Value.ORDER_TYPE_BC;
//		default:
//			break;
//		}
//		
//		mCouponUsable.lineid = line_id;
//		mCouponUsableTask = new CouponUsableTask(context, mCouponUsable, price,v);
//		mCouponUsableTask.execute();
//	}
//	
//	/**
//	 * 获取价格
//	 * 
//	 */
//	private class PriceTask extends BaseAsyncTask {
//
//		private PriceBuild mPriceBuild;
//
//		private View v;
//
//		public PriceTask(Activity context, PriceBuild mPriceBuild,
//				View v) {
//			super(context,false);
//			this.mPriceBuild = mPriceBuild;
//			this.v = v;
//		}
//
//		@Override
//		public void onSuccess(Object object) {
//			if(object!=null){
//				Price price=(Price)object;
//				getCouponUsable(price.getPrice(),v);
//			}
//			else{
//				ToastUtil.showToast(context, getResources().getString(R.string.no_network));
//				if (dialog != null) {
//					dialog.onDismiss();
//				}
//			}
//		
//		}
//
//		@Override
//		public void onFailed(int status, String msg) {
//			ToastUtil.showToast(context, getResources().getString(R.string.no_network));
//			if (dialog != null) {
//				dialog.onDismiss();
//			}
//		}
//
//		@Override
//		protected Object doInBackground(Object... params) {
//			// TODO Auto-generated method stub
//			String json = new JsonBuild().setModel(mPriceBuild)
//					.getJson();
//			return new PriceNet(context, json);
//		}
//	}
//
//	
//	/**
//	 * 可用优惠劵
//	 * 
//	 */
//	private class CouponUsableTask extends BaseAsyncTask {
//
//		private CouponUsable mCouponUsable;
//
//		private View v;
//		
//		private int price;
//
//		public CouponUsableTask(Activity context, CouponUsable mCouponUsable,int price,
//				View v) {
//			super(context,false);
//			this.mCouponUsable = mCouponUsable;
//			this.v = v;
//			this.price=price;
//			setIsReturnString(true);
//		}
//
//		@Override
//		public void onSuccess(Object object) {
//			if (object != null) {
//				CouponList mCouponList = new CouponList();
//				JSONArray ja_CouponList;
//				try {
//					List<Coupons> coupons_list = new ArrayList<Coupons>();
//					JSONObject json = new JSONObject((String) object);
//					ja_CouponList = json.getJSONArray(CouponMsg.msg_coupons);
//					for (int i = 0; i < ja_CouponList.length(); i++) {
//						Coupons mCoupons = new Coupons();
//						JSONObject jo = new JSONObject(ja_CouponList.get(i)
//								.toString());
//						mCoupons.setId(Integer.parseInt(jo.getString(CouponMsg.msg_id)));
//						mCoupons.setSum(Integer.parseInt(jo.getString(CouponMsg.msg_sum)));
//						mCoupons.setExpire_time(jo.getString(CouponMsg.msg_expire_time));
//						JSONObject jo_metadata = new JSONObject(
//								jo.getString(CouponMsg.msg_metadata));
//						Metadata mMetadata = new Metadata();
//						
//						JSONArray ja_line =new JSONArray(jo_metadata.getString(CouponMsg.msg_usableline));
//						List<String> list_line=new ArrayList<String>();
//						for(int j=0;j<ja_line.length();j++){
//							String str_line=ja_line.get(j).toString();
//							list_line.add(str_line);
//						}
//						mMetadata.setUsableline(list_line);
//						
//						mMetadata.setUsabletype(jo_metadata
//								.getString(CouponMsg.msg_usabletype));
//						mMetadata.setUsableorder(jo_metadata
//								.getString(CouponMsg.msg_usableorder));
//						mMetadata.setUsabletime(jo_metadata
//								.getString(CouponMsg.msg_usabletime));
//						mCoupons.setMetadata(mMetadata);
//						coupons_list.add(mCoupons);
//					}
//					mCouponList.setCouponList(coupons_list);
//				} catch (JSONException e) {
//				}
//				list_available.clear();
//				if (mCouponList != null && mCouponList.getCouponList() != null
//						&& !mCouponList.getCouponList().isEmpty()) {
//					list_available.addAll(mCouponList.getCouponList());
//					onShowSubmitPopView(price,v);
//				} else {
//					onShowSubmitPopView(price,v);
//				}
//				if (dialog != null) {
//					dialog.onDismiss();
//				}
//
//			}
//		}
//
//		@Override
//		public void onFailed(int status, String msg) {
//			if (dialog != null) {
//				dialog.onDismiss();
//			}
//			onShowSubmitPopView(price,v);
//		}
//
//		@Override
//		protected Object doInBackground(Object... params) {
//			// TODO Auto-generated method stub
//			String json = new JsonBuild().setModel(mCouponUsable)
//					.getJson();
//			return new CouponUsableNet(context, json);
//		}
//	}
//	/**
//	 * 提交POPview
//	 */
//	private void onShowSubmitPopView(final int price,View v) {
////		coupon_id=0;
////		View view = LayoutInflater.from(context).inflate(R.layout.pop_submit,
////				null);
////		final PopupWindow pop_submit = new PopupWindow(view,
////				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
////		pop_submit.setBackgroundDrawable(new BitmapDrawable());
////		pop_submit.setContentView(view);
////		pop_submit.setOutsideTouchable(false);
////		pop_submit.setFocusable(true);
////		pop_submit.showAtLocation(v, Gravity.CENTER, 0, 0);
////		TextView tv_price=(TextView) view.findViewById(R.id.tv_price);
////		tv_price.setText(FormatUtil.onFormatPrice(price));
////		  final LinearLayout layout=(LinearLayout) view.findViewById(R.id.layout);
////			Animation a = AnimationUtils.loadAnimation(context, R.anim.dialog_in);
////			layout.startAnimation(a);
////		final ListView listview = (ListView) view.findViewById(R.id.listview);
////		final AvailableCouponsAdapter mAvailableCouponsAdapter = new AvailableCouponsAdapter(
////				this, list_available);
////		listview.setAdapter(mAvailableCouponsAdapter);
////		// 选择可用的优惠劵
////		final RelativeLayout layout_choice_available = (RelativeLayout) view
////				.findViewById(R.id.layout_choice_available);
////		final TextView tv_choice_available = (TextView) view
////				.findViewById(R.id.tv_choice_available);
////		//选中的优惠劵
////		final TextView tv_selected=(TextView) view.findViewById(R.id.tv_selected);
////		if(mAvailableCouponsAdapter.getCount()!=0){
////			layout_choice_available.setVisibility(View.VISIBLE);
////			tv_choice_available.setVisibility(View.VISIBLE);
////			mAvailableCouponsAdapter.isSelected.put(0, true);
////			tv_selected.setText(String.format(context.getString(R.string.used_coupon), list_available.get(0).getSum()));
////			coupon_id = list_available.get(0).getId();
////		}
////		listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); 
////		listview.setOnItemClickListener(new OnItemClickListener() {
////			@Override
////			public void onItemClick(AdapterView<?> arg0, View v, int position,
////					long arg3) {
////				if(list_available.get(position).getSum().equals("0")){
////					tv_selected.setText(context.getString(R.string.no_used_coupon));
////				}
////				else{
////					tv_selected.setText(String.format(context.getString(R.string.used_coupon),list_available.get(position).getSum()));
////				}
////				coupon_id=list_available.get(position).getId();
////				   for(int i=0;i<list_available.size();i++){
////					   if(i==position){
////						   mAvailableCouponsAdapter.isSelected.put(i,true); 
////					   }
////					   else{
////						   mAvailableCouponsAdapter.isSelected.put(i,false);
////					   }
////				   }
////				   mAvailableCouponsAdapter.notifyDataSetInvalidated();	
////				   ViewHolder vHollder = (ViewHolder) v.getTag();    
////					//在每次获取点击的item时将对于的checkbox状态改变，同时修改map的值。    
////				   if(!vHollder.cb_available.isChecked()){
////				    	vHollder.cb_available.toggle();
////					}
////				   new Handler().postDelayed(new Runnable() {
////					
////					@Override
////					public void run() {
////						   listview.setVisibility(View.GONE);
////						   layout_choice_available.setBackgroundDrawable(context
////									.getResources().getDrawable(R.drawable.bg_yhq2));
////						   isOpenAvailable=false;
////					}
////				}, 10);
////	
////			}
////		});
////		layout_choice_available.setOnClickListener(new OnClickListener() {
////			@Override
////			public void onClick(View v) {
////				if(list_available.size()==0)return;
////				isOpenAvailable = isOpenAvailable ? false : true;
////				if (isOpenAvailable) {
////					listview.setVisibility(View.VISIBLE);
////					mAvailableCouponsAdapter.notifyDataSetChanged();
////					layout_choice_available.setBackgroundDrawable(context
////							.getResources().getDrawable(R.drawable.bg_yhq1));
////				} else {
////					listview.setVisibility(View.GONE);
////					layout_choice_available.setBackgroundDrawable(context
////							.getResources().getDrawable(R.drawable.bg_yhq2));
////				}
////
////			}
////		});
////		// 不允许
////		((Button) view.findViewById(R.id.btn_no_allow))
////				.setOnClickListener(new OnClickListener() {
////
////					@Override
////					public void onClick(View v) {
////						Animation a = AnimationUtils.loadAnimation(context, R.anim.dialog_out);
////						layout.startAnimation(a);
////						a.setAnimationListener(new AnimationListener() {
////							
////							@Override
////							public void onAnimationStart(Animation anim) {}
////							
////							@Override
////							public void onAnimationRepeat(Animation anim) {}	
////							@Override
////							public void onAnimationEnd(Animation anim) {
////								 new Handler().post(new Runnable() {
////							            @Override
////							            public void run() {
////							            	pop_submit.dismiss();
////							            }
////							        });
////							}
////						});
////					}
////				});
////		// 允许
////		((Button) view.findViewById(R.id.btn_allow))
////				.setOnClickListener(new OnClickListener() {
////
////					@Override
////					public void onClick(View v) {
////						// confirm.setClickable(false);
////						onOrderSubmit(price);
////						Animation a = AnimationUtils.loadAnimation(context, R.anim.dialog_out);
////						layout.startAnimation(a);
////						a.setAnimationListener(new AnimationListener() {
////							
////							@Override
////							public void onAnimationStart(Animation anim) {}
////							
////							@Override
////							public void onAnimationRepeat(Animation anim) {}	
////							@Override
////							public void onAnimationEnd(Animation anim) {
////								new Handler().post(new Runnable() {
////						            @Override
////						            public void run() {
////						            	pop_submit.dismiss();
////						            }
////						        });
////							}
////						});
////					}
////				});
//	}
//	 /**
//     * 设置Elements，用于提交订单和获取价格
//     */
//    public void setElements(){
//    	elements = new ArrayList<Elements>();
//		elements.clear();
//		Elements mElements=new Elements();
//		//出发地
//		Start start=new Start();
//		start.address=change_attribute.getStartName();
//		start.name=change_attribute.getName();
//		start.phone=change_attribute.getTel();
//		Location mLocation=new Location();
//		mLocation.lat=change_attribute.getStartLatitude();
//		mLocation.lng=change_attribute.getStartLongitude();
//		start.setLocation(mLocation);
//		//目的地
//		End end=new End();
//		end.address=change_attribute.getEndName();
//		end.name="";
//		end.phone="";
//		Location mLocation2=new Location();
//		mLocation2.lat=change_attribute.getEndLatitude();
//		mLocation2.lng=change_attribute.getEndLongitude();
//		end.setLocation(mLocation2);
//	
//        if (viewId == 0) {
//			mElements.count = change_attribute.getCount();
//			start.need_sms=change_attribute.getStart_need_sms();
//		}
//		else if (viewId == 1) {
//			mElements.count = 1;	
//			mElements.is_mutiple_oncar=change_attribute.getIs_mutiple_oncar();
//			start.need_sms=change_attribute.getStart_need_sms();
//		}
//    	mElements.start=start;
//		mElements.end=end;
//		elements.add(mElements);
//    }
//	/**
//	 * 提交订单，先默认不允许优惠劵
//	 */
//	public void onOrderSubmit(int price) {	
//		int travel_type=0;
//		OrderSubmit mOrderSubmit = new OrderSubmit(context);
//		mOrderSubmit.uid=mApplication.getUid();
//		mOrderSubmit.access_token=mApplication.getToken();
//		mOrderSubmit.order_name="test";
//		mOrderSubmit.price=price;
//		mOrderSubmit.old_order_id=old_order_id;
////		order_name.open_id=
//		mOrderSubmit.tel=mApplication.user_phone;
//		switch(viewId){
//		case 0:
//			mOrderSubmit.order_type=Value.ORDER_TYPE_PC;//:0（拼车），1（包车）,2（货），3（市内叫车）
//			mOrderSubmit.order_message=change_attribute.getMessage_PC();
//			break;
//		case 1:
//			mOrderSubmit.order_type=Value.ORDER_TYPE_BC;//:0（拼车），1（包车）,2（货），3（市内叫车）
//			mOrderSubmit.order_message=change_attribute.getMessage_BC();
//			break;
//		}
//	
//		mOrderSubmit.time = DateFormat.onDateAdd_ss(DateFormat.getCurrentTime());
//		mOrderSubmit.line_id=line_id;
//		if(change_attribute.getTime().equals(Value.now_time)){
//			mOrderSubmit.appoint_type = 0;
//		}
//		else{
//			mOrderSubmit.appoint_type = 1;
//		}
//		mOrderSubmit.travel_type=travel_type;
//		mOrderSubmit.appoint_time=DateFormat.onDateAdd_ss(change_attribute.getTime());//预约时间
//		mOrderSubmit.coupon_id=coupon_id;
//		mOrderSubmit.origin_type=0;
////		mOrderSubmit.service_uid="";
//		 if (viewId == 1) {
//			 mOrderSubmit.car_count=change_attribute.getCount_BC();
//		 }
//		mOrderSubmit.elements=elements;
//		mChangeOrderSubmitTask=new ChangeOrderSubmitTask(ChangeOrderActivity.context, mOrderSubmit,travel_type,coupon_id);
//		mChangeOrderSubmitTask.execute();	
//	}
//	public class ChangeOrderSubmitTask extends BaseAsyncTask {
//
//		private OrderSubmit mOrderSubmit;
//         private Activity context;
//         private int travel_type;
//         private int coupon_id;
//		public ChangeOrderSubmitTask(Activity context, OrderSubmit mOrderSubmit,int travel_type,int coupon_id) {
//			super(context);
//			this.context=context;
//			this.mOrderSubmit = mOrderSubmit;
//			this.travel_type=travel_type;
//			this.coupon_id=coupon_id;
//		}
//
//		@Override
//		protected Object doInBackground(Object... params) {
//			// TODO Auto-generated method stub
//			String json = new JsonBuild().setModel(mOrderSubmit).getJson();
//			return new ChangeOrderSubmitNet(context, json);
//		}
//
//		@Override
//		public void onSuccess(Object object) {
//			if (object != null) {
//				ChangeOrderId mChangeOrderId= (ChangeOrderId)object;
//				Log.e("", "提交成功,订单Id为："+mChangeOrderId.order_id);
//				onWriteDB_ing(mChangeOrderId.getOrderId(),travel_type,coupon_id);
//			} else {
//				ToastUtil.showToast(context, getResources().getString(R.string.no_network));
//			}
//		}
//
//		@Override
//		public void onFailed(int status, String msg) {
//			// TODO Auto-generated method stub
//			ToastUtil.showToast(context, getResources().getString(R.string.no_network));
//		}
//	}
//	@Override
//	public void startActivity(Intent intent) {
//		super.startActivity(intent);
//		overridePendingTransition(R.anim.base_slide_right_in,
//				R.anim.base_slide_remain);
//		Publisher.getInstance().removeOb(this);
//	}
//
//	public void startActivityForResult(Intent intent, int code) {
//		super.startActivityForResult(intent, code);
//		overridePendingTransition(R.anim.base_slide_right_in,
//				R.anim.base_slide_remain);
//		Publisher.getInstance().removeOb(this);
//	}
//
//	public static ArrayList<OnMenuClickListener> mOnMenuClickListenerList = new ArrayList<OnMenuClickListener>();
//	public static OnMenuClickListener mOnMenuClickListener;
//
//	/**
//	 * 自定义下面菜单点击监听
//	 */
//	public interface OnMenuClickListener {
//		public void OnMenuClick();
//	}
//
//	public static void setOnMenuClickListener(
//			OnMenuClickListener hOnMenuClickListener) {
//		mOnMenuClickListenerList.add(hOnMenuClickListener);
//	}
//
//	public void removeOnMenuClickListener(
//			OnMenuClickListener hOnMenuClickListener) {
//		mOnMenuClickListenerList.remove(hOnMenuClickListener);
//	}
//
//	@Override
//	public void onPopViewState(boolean isOpen) {
//		if (isOpen) {
//			pop_background.setVisibility(View.VISIBLE);
//		} else {
//			pop_background.setVisibility(View.GONE);
//		}
//
//	}
//	@Override
//	public void onAddressPopViewState(boolean isOpen) {
//		if (isOpen) {
//			pop_background.setVisibility(View.VISIBLE);
//		} else {
//			pop_background.setVisibility(View.GONE);
//		}
//	}
//	@Override
//	protected void onDestroy() {
//		if (mCouponUsableTask != null
//				&& mCouponUsableTask.getStatus() != AsyncTask.Status.FINISHED)
//			mCouponUsableTask.cancel(true);
//		if (mChangeOrderSubmitTask != null
//				&& mChangeOrderSubmitTask.getStatus() != AsyncTask.Status.FINISHED)
//			mChangeOrderSubmitTask.cancel(true);
//		if (mPriceTask != null
//				&& mPriceTask.getStatus() != AsyncTask.Status.FINISHED)
//			mPriceTask.cancel(true);
//		DatePicker.removeOnPoPViewStateListener(this);
//		Publisher.getInstance().removeOb(this);
//		super.onDestroy();
//	}
//
//	Handler mHandler = new Handler() {
//		public void handleMessage(android.os.Message msg) {
//			switch (msg.what) {
//			case 0:
//				initView();
//				break;
//			}
//		};
//	};
//
//	@Override
//	public void onPageScrollStateChanged(int arg0) {
//		// TODO Auto-generated method stub
//
//	}
//
//	@Override
//	public void onPageScrolled(int arg0, float arg1, int arg2) {
//		// TODO Auto-generated method stub
//
//	}
//
//	@Override
//	public void onPageSelected(int position) {
//		viewId = position;
//		onContentFilling();
//		switch (position) {
//		case 0:
//			setButton(btn_carpooling, tv_carpooling);
//			mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_NONE);
//			break;
//		case 1:
//			setButton(btn_charteredcar, tv_charteredcar);
//			mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_NONE);
//			break;
//		}
//	}
//
//	public boolean onKeyDown(int keyCode, KeyEvent event) {
//		// TODO Auto-generated method stub
//		if (keyCode == KeyEvent.KEYCODE_BACK) {
//			finish();
//			overridePendingTransition(0, R.anim.base_slide_right_out);
//
//			return true;
//
//		}
//		return false;
//	}
//
//	/**
//	 * 主界面内容填写监听方法
//	 */
//	@Override
//	public void onContentFilling() {
//		switch (viewId) {
//		case 0:// 拼车出行
//			if (isNull(change_attribute.getTime())
////					&& isNull(change_attribute.getName())
//					&& isNull(change_attribute.getTel())
//					&& isNull(change_attribute.getStartName())
//					&& isNull(change_attribute.getStartLatitude())
//					&& isNull(change_attribute.getStartLongitude())
//					&& isNull(change_attribute.getEndName())
//					&& isNull(change_attribute.getEndLatitude())
//					&& isNull(change_attribute.getEndLongitude())
//					) {
//				confirm.setEnabled(true);
//			} else {
//				confirm.setEnabled(false);
//			}
//			break;
//		case 1:// 包车出行
//			if (isNull(change_attribute.getTime())
////					&& isNull(change_attribute.getName())
//					&& isNull(change_attribute.getTel())
//					&& isNull(change_attribute.getStartName())
//					&& isNull(change_attribute.getStartLatitude())
//					&& isNull(change_attribute.getStartLongitude())
//					&& isNull(change_attribute.getEndName())
//					&& isNull(change_attribute.getEndLatitude())
//					&& isNull(change_attribute.getEndLongitude())
//					) {
//				confirm.setEnabled(true);
//			} else {
//				confirm.setEnabled(false);
//			}
//			break;
//		}
//
//	}
//
//	public boolean isNull(String s) {
//		if (s != null && !s.equals(""))
//			return true;
//		return false;
//	}
//	public boolean isNull(Double d) {
//		if (d != null )
//			return true;
//		return false;
//	}
//	public boolean isNull(Integer i) {
//		if (i != null )
//			return true;
//		return false;
//	}
//	/**
//	 * 写入进行中的订单数据
//	 */
//	private void onWriteDB_ing(String order_id, int travel_type,
//			int coupon_id) {
//		OfficialOrderList mOfficialOrderList = new OfficialOrderList();
//		// mOfficialOrderList.setId("");
//		mOfficialOrderList.setOrder_id(order_id);
//		switch (viewId) {
//		case 0:
//			mOfficialOrderList.setOrder_type(0);
//			break;
//		case 1:
//			mOfficialOrderList.setOrder_type(1);
//			break;
//		}
//		mOfficialOrderList.setAppoint_time(DateFormat.onDateAdd_ss(change_attribute
//				.getTime()));
//		mOfficialOrderList.setLine_id(line_id);
//		mOfficialOrderList.setTravel_type(travel_type);
//		mOfficialOrderList.setCoupon_id(String.valueOf(coupon_id));
//		mOfficialOrderList.setOrder_status(Value.ORDER_STATUS_UNTREATED);// 未处理
//		mOfficialOrderList.setValuate_status(String.valueOf(Value.VALUATE_STATUS_NO));// 待评价
//		switch(viewId){
//		case 0:
//			mOfficialOrderList.setMessage(change_attribute.getMessage_PC());
//			break;
//		case 1:
//			mOfficialOrderList.setMessage(change_attribute.getMessage_BC());
//			break;
//		}
//
//		OfficialOrderDetail mOfficialOrderDetail = new OfficialOrderDetail();
//		Start mStart = new Start();
//		mStart.setAddress(change_attribute.getStartName());
//		mStart.setName(change_attribute.getName());
//		mStart.setPhone(change_attribute.getTel());
//		mStart.setNeed_sms(change_attribute.getStart_need_sms());
//		Location mLocation_start = new Location();
//		mLocation_start.setLat(change_attribute.getStartLatitude());
//		mLocation_start.setLng(change_attribute.getStartLongitude());
//		mStart.setLocation(mLocation_start);
//		End end = new End();
//		end.setAddress(change_attribute.getEndName());
//		end.setName(change_attribute.getName2());
//		end.setPhone(change_attribute.getTel2());
//		end.setNeed_sms(change_attribute.getEnd_need_sms());
//		Location mLocation_end = new Location();
//		mLocation_end.setLat(change_attribute.getEndLatitude());
//		mLocation_end.setLng(change_attribute.getEndLongitude());
//		end.setLocation(mLocation_end);
//		mOfficialOrderDetail.setStart(mStart);
//		mOfficialOrderDetail.setEnd(end);
//        if (viewId == 0) {
//        	mOfficialOrderDetail.setCount(change_attribute.getCount());
//		}
//		else if (viewId == 1) {
//			mOfficialOrderDetail.setCount(change_attribute.getCount_BC());
//		}
//		
//		mOfficialOrderDetail.setVolume(String.valueOf(change_attribute.getGoodsVolume()));
//		mOfficialOrderDetail.setWeight(String.valueOf(change_attribute.getGoodsWeight()));
//		mOfficialOrderDetail.setIs_mutiple_oncar(change_attribute.getIs_mutiple_oncar());
//		mOfficialOrderList.setOrderDetail(mOfficialOrderDetail);
//		db_myordering.onWriteDB_ing(context, mOfficialOrderList);
//		db_myorder.onWriteDB(context, mOfficialOrderList);
//		db_myordering.onDelete(this,old_order_id);
//		db_myorder.onDelete(this, old_order_id);
//		db_address.onWrite(change_attribute.getStartName(), change_attribute.getStartCity(),change_attribute.getStartAddress(), change_attribute.getStartLongitude(), change_attribute.getStartLatitude(),Value.ADDRESS_TYPE_HISTORY);
//		db_address.onWrite(change_attribute.getEndName(), change_attribute.getEndCity(), change_attribute.getEndAddress(), change_attribute.getEndLongitude(), change_attribute.getEndLatitude(),Value.ADDRESS_TYPE_HISTORY);
//		// 存储在线消息数据
//		JmsgDB db_jmsg = new JmsgDB(context);
//		db_jmsg.onWrite(mOfficialOrderList.getOrder_id(), mOfficialOrderList.getOrder_time(), GMsg.ONLINE_XIADAN, null);
//		Intent intent = new Intent(context, StartServiceActivity.class);
//		intent.putExtra(OrderMsg.extra_type, 0);
//		intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//		startActivity(intent);
//		confirm.setClickable(true);
//	}
//
//	@Override
//	public void onNotify(int type,JSONObject jb,Msgs.Data msgs_data){
//		switch (type) {
//		case GMsg.OFFICAIL_ONLINE_PAIDAN:
//			ToastUtil.showToast(context, R.string.msg_paidan);
//			break;
//		case GMsg.ONLINE_CANCEL:
//		case GMsg.ONLINE_KF_CANCEL:
//			MyTypeDailog canceldialog = new MyTypeDailog(this);
//			canceldialog.setModel(MyTypeDailog.TYPE_CANCEL, msgs_data);
//			break;
//		case GMsg.ONLINE_GAIPAI:
//		case GMsg.ONLINE_KF_GAIPAIL:
//			MyTypeDailog gaipaidialog = new MyTypeDailog(this);
//			gaipaidialog.setModel(MyTypeDailog.TYPE_GAIPAI, msgs_data);
//			break;
//		case GMsg.ONLINE_ONCAR:   
////			ToastUtil.showToast(context, R.string.msg_oncar);
//			break;
//		case GMsg.ONLINE_OFFCAR://下车
//			if (msgs_data != null) {
//				final String order_id=msgs_data.getOrder_id();
//				MyOrderingDB db_myordering = new MyOrderingDB(context);// 我的进行中的订单数据库
//				OfficialOrderList mOfficialOrderList = db_myordering.onReadDB_ing(context,
//						order_id);
//				String start_city = ToCity.getCity(mOfficialOrderList.getOrderDetail()
//						.getStart().getAddress());
//				String end_city = ToCity.getCity(mOfficialOrderList.getOrderDetail()
//						.getEnd().getAddress());
//				final MyPayOrderDailog payorder_dialog=new MyPayOrderDailog(context);
//				payorder_dialog.setOrderId(order_id);
//				payorder_dialog.setMoney(FormatUtil.onFormatPrice(mOfficialOrderList.getPrice()));
//				payorder_dialog.setContent(String.format(getString(R.string.order),DateFormat.onDateRemove_ss(mOfficialOrderList
//						.getAppoint_time())+"\n"+start_city+"到"+end_city));
//				if (payorder_dialog != null && !payorder_dialog.isShowing()) {
//					payorder_dialog.show();
//				}
//				payorder_dialog.setOnClickPayListener(new onClickPayListener() {		
//					@Override
//					public void onClickPay() {
//						Intent intent = new Intent(context,
//								OrderEvaluationActivity2.class);
//						intent.putExtra(OrderMsg.order_id_finish,order_id);
//						intent.putExtra(OrderMsg.finish_type,
//								OrderMsg.finish_ing);
//						context.startActivity(intent);
//					}
//				});
//			}
//			break;
//		case GMsg.ONLINE_FINISH:
//			ToastUtil.showToast(context, R.string.msg_finish);
//			break;
//		case GMsg.ONLINE_BUSY:
//			String text = null;
//			try {
//				JSONObject json_jmsg = jb.getJSONObject(GMsg.msg_jmsg);
//				JSONObject jmsg_data = new JSONObject(json_jmsg.getString(GMsg.msg_data));
//				 msgs_data = (Msgs.Data) new JsonBuild().getData(Msgs.Data.class,
//							jmsg_data.toString());
//			} catch (JSONException e1) {
//			}
//	        if(msgs_data!=null&&msgs_data.getText()!=null){
//	        	MyOrderingDB db_myordering = new MyOrderingDB(context);// 我的进行中的订单数据库
//				OfficialOrderList mOfficialOrderList = db_myordering.onReadDB_ing(context,
//						msgs_data.getOrder_id());
//				String start_city = ToCity.getCity(mOfficialOrderList.getOrderDetail().getStart().getAddress());
//				String end_city =ToCity.getCity(mOfficialOrderList.getOrderDetail().getEnd()
//						.getAddress());
//				MyBusyDailog busyDailog=new MyBusyDailog(this);
//				busyDailog.setTitle(msgs_data.getText());
//				busyDailog.setContent(DateFormat
//						.onDateRemove_ss(mOfficialOrderList.getAppoint_time())+"\n"+start_city+"→"+end_city);
//				if (busyDailog != null && !busyDailog.isShowing()) {
//					busyDailog.show();
//				}
//	        }
//			break;
//		case GMsg.ONLINE_RELOGIN:
//			stopService(new Intent(this, LoginService.class));
//			MyAlertDailog dialog=new MyAlertDailog(this);
//			dialog.setTitle(getString(R.string.mydailog_title));
//			dialog.setContent(getString(R.string.mydailog_content_login));
//			dialog.setLeftButtonText(getString(R.string.mydailog_exit));
//			dialog.setRightButtonText(getString(R.string.mydailog_relogin));
//			if (dialog != null && !dialog.isShowing()) {
//				dialog.show();
//			}
//			dialog.setOnClickLeftListener(new onClickLeftListener() {	
//				@Override
//				public void onClickLeft() {
//					stopService(new Intent(context, LoginService.class));
//					DataCleanManager.cleanDatabases(context);
//					DataCleanManager.cleanSharedPreference(context);
//					Intent intent= new Intent(context, MainActivity.class);
//					intent.putExtra(MainMsg.extra_quit, MainMsg.INTENT_QUIT);
//					intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//					startActivity(intent);
//					overridePendingTransition(0,0);
//					finish();
//					overridePendingTransition(0,0);
//				}
//			});
//			dialog.setOnClickRightListener(new onClickRightListener() {
//				
//				@Override
//				public void onClickRight() {
//					Intent intent = new Intent(); 
//					intent.setClass(context, LoginActivity.class); 
//					startActivity(intent);
//				}
//			});
//			break;
//		}
//	}
//
//}
